package io.characterStream.fileRorW.test;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

/*
将一个文件拷贝到另一个地方
 */
public class test1 {
    public static void main(String[] args) throws IOException {
        long start = System.currentTimeMillis();
        FileInputStream fis = new FileInputStream("E:\\Desktop\\20-7毕业照.jpg");
        FileOutputStream fos = new FileOutputStream("E:\\javaFileTest\\20-7毕业照.jpg");
        //一般写1024的整数倍
        byte[] bys = new byte[1024];
        int len;
        while((len = fis.read(bys))!=-1){
            fos.write(bys,0,len);
        }
        fis.close();
        fos.close();
        long end = System.currentTimeMillis();
        System.out.println(end-start);
    }
}
